package com.ad.pet.app.account.share;

import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.common.data.utils.SpUtil;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.constant.Constant;
import com.ad.pet.models.remote.account.share.ShareGoodItem;
import com.ad.pet.ui.SimpleDividerDecoration;

import java.util.List;

/**
 * Created by liuyixiang on 2019/9/21.
 */

public class ShareItemGoodAdapter extends BaseQuickAdapter<ShareGoodItem, BaseViewHolder> {


    public ShareItemGoodAdapter(@Nullable List<ShareGoodItem> data) {
        super(R.layout.item_shae_good_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ShareGoodItem item) {
        ImageView ivHead = helper.getView(R.id.iv_head);
        TextView tvTitle=helper.getView(R.id.tv_title);
        TextView tvPrice=helper.getView(R.id.tv_price);
        RecyclerView recycelrRecordPrice=helper.getView(R.id.recycelr_record_price);

        GlideUtil.load(mContext,item.getImage(),ivHead);
        tvTitle.setText(item.getName());
        tvPrice.setText(SpUtil.getInstance().getString(Constant.CURRENCY_LABEL,"US $")+item.getProduct_price());
        ShareFrendAdapter shareFrendAdapter=new ShareFrendAdapter(item.getList());
        recycelrRecordPrice.addItemDecoration(new SimpleDividerDecoration(mContext,2,R.color.bg_color));
        recycelrRecordPrice.setAdapter(shareFrendAdapter);

    }
}
